package com.xh.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.xh.entiy.CourseVideo;
import com.xh.repository.CourseVideoRespository;

@Component
public class CourseVidoeService {

	@Autowired
	private CourseVideoRespository courseVideoRespository;
	
	public List<CourseVideo> getcourseVideos()
	{
		return (List<CourseVideo>) courseVideoRespository.findAll();
	}
	
	public CourseVideo getcourseVideo(Integer Id)
	{
		return courseVideoRespository.findOne(Id);
	}
	
	public CourseVideo saveOrupdate(CourseVideo courseVideo)
	{
		return courseVideoRespository.save(courseVideo);
	}
	
	public void deleteCoursevido(Integer Id)
	{
		courseVideoRespository.delete(Id);
	}
	
	public List<CourseVideo> findByCatalogId(Integer id){
		return courseVideoRespository.findByCatalog_id(id);
	}
	
}
